perm filename SPECIA.MSG[COM,LSP] blob
sn#820696 filedate 1986-07-12 generic text, type C, neo UTF8
COMMENT ā VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 Consider this example:
C00004 ENDMK
Cā;
Consider this example:
(defun bazola (a)
(let* ((a (foo))
(b (+ a 3 (foo)))
(a (+ b a)))
(declare (special a b)) ...))
where foo is a function that refers freely to a.
I will now rename the variables by adding an index to each to
make it easier to understand to what I'm referring at all times.
<a0>
(defun bazola (a1)
(let* ((a2 (foo))
(b (+ a3 3 (foo)))
(a4 (+ b a5)))
(declare (special a b)) ...))
where a0...a5 all are synonyms for a, and a0 is the global, a.
Now we expand according to Pavel's proposal:
<a0>
(defun bazola (a1)
(let ((a2 (foo)))
(declare (special a))
(let ((b (+ a3 3 (foo))))
(declare (special b))
(let ((a4 (+ b a5))) ...))))
A1 is a lexical variable.
A2 is special (and dynamically rebinds the global A0)
A3 refers to the special A2 (A0)
A4 is a lexical variable, whose value is set to that of the
special A2 (A0)
If we want A4 to also be special, then we must write:
(defun bazola (a)
(let* ((a (foo))
(b (+ a 3 (foo))))
(declare (special a b))
(let ((a (+ b a))) (declare (special a)) ...)))